package com.socket.websocket.java;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import javax.websocket.Endpoint;
import javax.websocket.server.ServerApplicationConfig;
import javax.websocket.server.ServerEndpointConfig;
import java.util.Set;

/**
 * Created by kaddddd on 2017/7/7 0007.
 * java方式
 */
//@Configuration
//@EnableWebSocketMessageBroker
public class WebSocketConfig_java /*implements ServerApplicationConfig*/ {
//    //注解的方式 启动
//    public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scan) {
//        System.out.println("-------------websoket start-----------------");
//        System.out.println("scan.size() = " + scan.size());
//
//        return scan; //必须要返回scan,否则会造成连接失败
//    }
//
//    //接口方式启动
//    public Set<ServerEndpointConfig> getEndpointConfigs(
//            Set<Class<? extends Endpoint>> arg0) {
//
//        return null;
//    }
//
//    @Bean
//    public ServerEndpointExporter serverEndpointExporter() {
//        System.out.println("-------------websoket start-----------------");
//        return new ServerEndpointExporter();
//    }
}
